outputChart


The outputChart component uses the JCharts open source charting utility (http://jcharts.sourceforge.net/) to create charts. The two main types of charts that can be created with this component are pie charts and axis charts.

Usability

Summary of chart subtypes:

These various types of charts use the same underlying data structure which allows the chart type to be changed dynamically.

Interactivity

The participation of this component with the jsf lifecycle allows developers to hook actionListeners to a clientSideImageMap. This feature can be harnessed to provide drill down behavior.

Flexibility

The outputChart component provides a flexible way of defining component data. The data for the outputChart component can be defined statically in the jsf page or dynamically using a bean.

        Defining the colors of the chart in the jsf page:
        <ice:outputChart colors="red, blue, green" .... />

        Defining the colors using a bean:
        <ice:outputChart colors="#{bean.colors}" ..../>

        The "colors" method of the bean may return either a java.util.List of java.awt.Color or an array of java.awt.Color.

Axis type charts can be generated using many data sets. The data can be set using a two dimensional double array.

        Defining the data for an axis type chart in the jsf page for two data sets:
        <ice:outputChart data="10, 30, 40, 33: 30, 20, 30, 40"/>

        NOTE: the colon(":") is used as the identifier for a new data set.

        Defining the data for an axis type chart in the jsf page for three data sets:
        <ice:outputChart data="10, 30, 40, 33: 30, 20, 30, 40: 33, 44, 22, 55"/>

        Defining the data for an axis type chart using a bean:
        <ice:outputChart data="#{bean.data}" ....../>


        The "data" method of the bean may return either a java.util.List of double array for each pair value, or a double array.

Efficiency

By default the chart component renders only on the first render cycle and any further render requests will not cause it to be re-rendered unless specified. The rendering of a chart can be an expensive operation if it renders on every render phase. The renderOnSubmit attribute lets the developer decide when to render the chart.

Examples

//render the default chart with the default data (default type is bar)
<ice:outputChart />

//render barstacked type of chart
<ice:outputChart type="barstacked"
        chartTitle="Book Sales"
        yaxisTitle="Sales"
        xaxisTitle="Months"
        xaxisLabels="Jan, Feb, Mar, Apr"
        labels="JSF, AJAX"
        data="20, 55, 22, 44: 22, 33, 44, 55"
/>

//render pie3d chart
<ice:outputChart type="pie3d"
        chartTitle="Book Sales"
        labels="JSF, AJAX, Web Services"
        data="99, 50, 20"
        colors="blue, green, cyan"
/>

Tag Summary

tag-name:
<ice:outputChart>
tag-class:
com.icesoft.faces.component.outputchart.OutputChartTag
component-class:
com.icesoft.faces.component.outputchart.OutputChart
component-type:
com.icesoft.faces.OutputChart
component-family:
javax.faces.Command
renderer-class:
com.icesoft.faces.component.outputchart.OutputChartRenderer
renderer-type:
com.icesoft.faces.OutputChartRenderer